﻿using DimensionsHelper.Common.Contracts.Metadata;

namespace DimensionsHelper.Client.WinUi.ViewModels;

public partial class MetadataTemplateViewModel(string name)
    : MetadataNamedViewModel(name, MetadataNamedObjectKind.Template)
{
    [ObservableProperty]
    public partial string Value { get; set; } = string.Empty;

    public override string ToString() => $"{Name} = \"{Value}\"";

    public static MetadataTemplateViewModel FromMetadata(ITemplate template)
    {
        return new MetadataTemplateViewModel(template.Name)
        {
            Value = template.Value
        };
    }
}